package com.wow.wa.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.util.Log;

public abstract class DateFormat {

	private static final String TAG = DateFormat.class.getSimpleName();

	public abstract SimpleDateFormat getFormat();

	private Date nowDate;

	public String getSpecialDay(String day) {
		return this.getFormat().format(this.getDate(day));
	}
	
	public DateFormat(){
		this.nowDate=new Date();
	}

	/**
	 * 取得現在時間
	 * 
	 * @return
	 */
	@Override
	public String toString() {

		return this.getFormat().format(this.nowDate);
	}

	

	

	public Date getDate() {

		try {
			return this.getFormat().parse(this.toString());
		} catch (ParseException e) {
			Log.v(TAG, "getDate e=" + e);
		}
		return null;
	}

	public Date getDate(String inStringData) {
		try {
			return this.getFormat().parse(inStringData);
		} catch (ParseException e) {
			Log.v(TAG, "getDate e=" + e);
		}
		return null;
	}

	public Date getNowDate() {
		return nowDate;
	}

	public void setNowDate(Date nowDate) {
		this.nowDate = nowDate;
	}

}
